<template>
  <div class="account-config">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane :label="$t('qualityCheck.qualityTemplate')" name="qualityTemplate">
      </el-tab-pane>
      <el-tab-pane :label="$t('configLazyLoad.qualityCheck.qualityCheckCycleConfig')" name="qualityCycle">
      </el-tab-pane>
      <el-tab-pane :label="$t('configLazyLoad.qualityCheck.laborPerformance')" name="artificialPerformance">
      </el-tab-pane>
      <el-tab-pane :label="$t('configLazyLoad.qualityCheck.monitoringType')" name="dataType">
      </el-tab-pane>
    </el-tabs>
    <keep-alive>
      <router-view @cycle="getCycleOption" :cycleOptions="cycleOptions"></router-view>
    </keep-alive>
  </div>
</template>
<script>
  export default {
    name: 'qualityCheckConfig',
    data () {
      return {
        cycleOptions: [],
        activeName: 'qualityTemplate'
      }
    },
    methods: {
      getCycleOption (data) {
        this.cycleOptions = data
      },
      handleClick (tab) {
        this.$router.push({path: '/index/config/qualityCheckConfig/' + tab.name})
      }
    },
    beforeRouteLeave (to, from, next) {
      // this.currentRoute = from.fullPath
      next()
    },
    beforeRouteEnter (to, from, next) {
      next(vm => {
        // if (to.query.active) {
        // } else if (vm.currentRoute) {
        //   vm.$router.push({path: vm.currentRoute})
        // }
      })
    }
  }
</script>
